import 'package:dio/dio.dart';
import 'package:part_time_job_pro/common/base/base_model.dart';
import 'package:part_time_job_pro/common/base/base_rows_list_model.dart';
import 'package:part_time_job_pro/common/models/full_job_type.dart';
import 'package:part_time_job_pro/common/models/full_time_job.dart';
import 'package:part_time_job_pro/common/models/login_user.dart';
import 'package:part_time_job_pro/common/models/models.dart';
import 'package:part_time_job_pro/common/values/server_config.dart';
import 'package:retrofit/retrofit.dart';

part 'rest_client.g.dart';

/*
 * @author jackieWang
 * 2025/10/13 11:34
 * 类说明: 请求接口
 */
@RestApi(parser: Parser.JsonSerializable)
abstract class RestClient {
  factory RestClient(Dio dio, {String? baseUrl}) = _RestClient;

  //用户账号登录
  @POST(HttpConfig.accountLogin)
  Future<BaseModel<LoginUser?>?> accountLogin(@Query("account") String account, @Query("password") String password);

  //短信验证登录
  @POST(HttpConfig.smsCodeLogin)
  Future<BaseModel<LoginUser?>?> smsCodeLogin(@Query("mobile") String mobile, @Query("smsCode") String smsCode);

  //获取短信验证码
  @POST(HttpConfig.sendSmsCode)
  Future<BaseModel?> sendSmsCode(@Query("mobile") String mobile, @Query("type") String type);

  //退出登录
  @POST(HttpConfig.userLogout)
  Future<BaseModel?> userLoginOut();

  //获取兼职类型
  @GET(HttpConfig.partJobType)
  Future<BaseModel<List<PartJobType>?>?> getPartJobTypeList();

  //获取兼职列表
  @GET(HttpConfig.partTimeJobList)
  Future<BaseModel<BaseRowsListModel<PartTimeJob>?>?> getPartTimeJobList(@Queries() Map<String, dynamic> params);

  //获取兼职类型模板
  @GET(HttpConfig.getPartJobTypeTemp)
  Future<BaseModel<List<PartTypeTemp>?>?> getPartJobTypeTempList(@Query("typeId") int typeId);

  //搜索兼职类型
  @GET(HttpConfig.searchPartJobType)
  Future<BaseModel<List<PartJobType>?>?> searchPartJobType(@Query("searchText") String keyword);

  //获取全职类型
  @GET(HttpConfig.fullJobType)
  Future<BaseModel<List<FullJobType>?>?> getFullJobTypeList();

  //获取全职列表
  @GET(HttpConfig.fullTimeJobList)
  Future<BaseModel<BaseRowsListModel<FullTimeJob>?>?> getFullTimeJobList(@Queries() Map<String, dynamic> params);

  //获取字典数据
  @GET(HttpConfig.getDictData)
  Future<BaseModel<List<SysDictData>?>?> getDictDataList(@Query("dictKey") String dictKey);
}
